#pragma once
#include "state_machine.h"

class XmlTreeNode : public ui::TreeNode
{
public:
	//virtual void OnClickItem() override;
	//virtual void OnDoubleClickItem() override;
	virtual void SetExpand(bool bExpand) override;
};

class XmlTree : public ui::TreeView, public IStateReceiver
{
public:
	XmlTree();
	virtual ~XmlTree();
	
	bool InsertControl(Control* control, Box* parent);
	bool InsertBox(Box* box, Box* parent);
	bool ReBuiildTree(Box* root, Control* control);

	ui::TreeNode *FindNodeByDataId(std::string id);
	ui::TreeNode *FindNodeByDataId(ui::TreeNode *parentNode, std::string id);

	virtual bool DoStateEvent(std::shared_ptr<StateEvent> event) override;
private:
	ui::TreeNode *m_pRootBox{ nullptr };
};

